﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using LGSVR.Common;

namespace LGSVR.BLL.Terminal
{
    public class CardLightBLL
    {
        public DataTable GetCardLightByGroupID(string groupID)
        {
            string sql = "select ROW_NUMBER() over(order by id) as RowID,* from cardLight    ";
            if (groupID != "")
            {
                sql += " where cardGroup=@cardGroup";
            }
            List<SqlParameter> lstParam = new List<SqlParameter>();
            lstParam.Add(new SqlParameter("@cardGroup", groupID));
            DataTable dt = SQLHelper.GetDataTable(sql, CommandType.Text, lstParam.ToArray());           
            return dt;
        }

        public int DeleteByGroupID(string groupID)
        {
            string sql = "delete cardLight where cardGroup=@cardGroup";
            List<SqlParameter> lstParam = new List<SqlParameter>();
            lstParam.Add(new SqlParameter("@cardGroup", groupID));
            int i= SQLHelper.ExecuteNonQuery(sql, CommandType.Text, lstParam.ToArray());
            return i;
        }
    }
}
